﻿#ifndef MARKDIALOG_H
#define MARKDIALOG_H

#include <QDialog>
#include <QVector>
#include "element.h"

namespace Ui {
class MarkDialog;
}

class LineData
{
public:
    LineData() {}
    LineData(QPointF start, QPointF end, double length) {m_start = start; m_end = end; m_length_um = length;}
    LineData(LineData &data){ m_start = data.m_start; m_end = data.m_end; m_length_um = data.m_length_um;}
    QPointF m_start;
    QPointF m_end;
    double m_length_um;
};

class CircleData
{
public:
    CircleData(){}
    CircleData(QPointF center, double dia){m_center = center; m_diameter_um = dia;}
    QPointF m_center;
    double m_diameter_um;
};

class AngleData
{
public:
    AngleData(){}
    AngleData(QPointF start, QPointF mid, QPointF end, double angle){m_start = start; m_mid = mid; m_end = end; m_angle =angle;}
    QPointF m_start;
    QPointF m_mid;
    QPointF m_end;
    double m_angle;
};

class MarkDialog : public QDialog
{
    Q_OBJECT

public:
    explicit MarkDialog(QWidget *parent = 0);
    ~MarkDialog();
    void clearAll() {m_lines.clear(); m_angles.clear(); m_circles.clear();}
    void addLine(QPointF start, QPointF end, double length);
    void addCircle(QPointF center, double dia);
    void addAngle(QPointF start, QPointF end, QPointF mid, double angle);
public slots:
    void showLines();
    void showCircles();
    void showAngles();
private slots:
    void copyToClipboard();
    void saveToFile();
private:

    QString linesDataString(QChar sep);
    QString circlesDataString(QChar sep);
    QString angleDataString(QChar sep);

private:
    Ui::MarkDialog *ui;
    QVector<LineData> m_lines;
    QVector<AngleData> m_angles;
    QVector<CircleData> m_circles;
    int m_count;
    QString m_dir;
};

#endif // MARKDIALOG_H
